<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
<style> label{ display: block;} .errors {color:red;}</style>
</head>
<body>
<div class="login">
<p>
<?php 
if (!isset($_SESSION['display_name']))
echo "You need to ".anchor('auth/login', 'login');
else echo 'Welcome '.$_SESSION['display_name'].'. Click '. anchor('auth/logout', 'here').' to logout';
?>
</p>
</div>

<div class="thread_new_button">
	<input type="button" value="New Thread" onclick="window.location='<?php echo site_url('/frontend/create/')?>'"/>
</div>

<div class="paging_navigator">
	<span>Pages: </span>
	<?php if ($currentPage-2 > 1) : ?>
		<span>
		<?php echo anchor('frontend/tag?tag='.$tag.'&current_page=1', 1); ?>
		<?php if($currentPage-3 > 1) { echo ' ... '; } ?>
		</span>
	<?php endif; ?>
	<span><?php if ($currentPage-1 > 1) { echo anchor('frontend/tag?tag='.$tag.'&current_page='.($currentPage-2), $currentPage-2); } ?></span>
	<span><?php if ($currentPage > 1) { echo anchor('frontend/tag?tag='.$tag.'&current_page='.($currentPage-1), $currentPage-1); } ?></span>  
	<span><b><?php echo $currentPage; ?></b></span>
	<span><?php if ($currentPage < $lastPage) { echo anchor('frontend/tag?tag='.$tag.'&current_page='.($currentPage+1), $currentPage+1); } ?></span>
	<span><?php if ($currentPage+1 < $lastPage) { echo anchor('frontend/tag?tag='.$tag.'&current_page='.($currentPage+2), $currentPage+2); } ?></span>
	<?php if ($currentPage+2 < $lastPage) : ?>
	<span>
		<?php if ($currentPage+3 < $lastPage) { echo ' ... '; } ?>
		<?php echo anchor('frontend/tag?tag='.$tag.'&current_page='.$lastPage, $lastPage); ?>
	</span>
	<?php endif; ?>
</div>

<?php foreach ($threads as $row) : ?>
	<div class="thread_box">
		<!-- Title -->
		<div class="thread_title_bar"><span><?php echo $row->id.' '.$row->title; ?></span></div>
		<!-- Content -->
		<div class="thread_content_box">
			<span><?php echo $row->content; ?></span>
			<?php echo anchor('frontend/thread/'.$row->id, 'More...'); ?>
			<br />
			<span><?php echo $row->created_date;?></span>
			<br />
			<span>Bump date: <?php echo $row->bump_date;?></span>
			<?php //echo anchor('frontend/delete/'.$row->id, 'Delete'); ?>
		</div>
	</div>
<?php endforeach; ?>
</body>
</html>